/*
 * By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
 * we can see that the 6th prime is 13.
 * 
 * What is the 10,001st prime number?
 */
package pj1;

class Problem7 {
	
	static final int problem = 10001;

	//checks whether an int is prime or not.
	private static boolean isPrime(int num)
	{
		boolean prime = true;
		int limit = (int)Math.sqrt(num);  

		for(int i=2; i <= limit; i++) {
			if(num%i == 0) {
				prime = false;
				break;
			}
		}
		return prime;
	}

	public static void main(String[] args) {
		int n = 2;
		int i = 0;
		while (i < problem) {
			if (isPrime(n)) {
				i++;
				if (i == problem) {
					break;
				}
			}
			n++;
		}
		System.out.println(n);
	}

}
